package user.zc.excel.data.builder;



import user.zc.excel.data.info.ColumnCell;
import user.zc.excel.data.info.ICell;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

public class ColumnBuilder<T>  implements IBuilder<T, ICell.CellInfo[]> {

    @Override
    public ICell.CellInfo[] collect(Class<T> clazz) {
        List<Field> fields = fields(clazz);
        List<ICell.CellInfo> cellInfoList = new ArrayList<>();
        for (Field field : fields) {
            cellInfoList.add(new ColumnCell().parse(field));
        }
        return cellInfoList.toArray(new ICell.CellInfo[cellInfoList.size()]);
    }
}
